import { useEffect, useState, useRef } from "react";
import { QueryTable } from "@/components/QueryTable";
// import BusinessActionDrawer from "../businessActionDrawer"
// import { customerTypeMapping } from '@/utils';
// import { message } from "antd";

/**
 * 业务管理-放款
 */
export default function Loan() {
  // const [actionDrawerStatus, setActionDrawer] = useState(false);
  // const [editItem, setEditItem] = useState({})
  const tableRef = useRef()

  const onFinish = (data: any) => {
    tableRef?.current?.refreshTable()
  };

  const columns = [
    {
      dataIndex: "customerCode",
      key: "customerCode",
      title: "客户编号",
      ellipsis: true,
      searchConfig: {
        type: 'input',
      },
    },
    {
      dataIndex: "customerName",
      key: "customerName",
      title: "客户姓名",
      ellipsis: true,
      searchConfig: {
        type: 'input',
      },
    },
    {
      dataIndex: "actualLoanLimitTime",
      key: "actualLoanLimitTime",
      title: "放款时间",
      timeFormat: "YYYY-MM-DD",
    },
    {
      dataIndex: "actualLoanLimit",
      key: "actualLoanLimit",
      title: "放款金额",
    },
    {
      dataIndex: "remark",
      key: "remark",
      title: "备注",
      ellipsis: true,
    },
    // {
    //   dataIndex: "action",
    //   key: "action",
    //   title: "操作",
    //   fixed: 'right',
    // }
  ]
  return (
    <div className="feedback-container">
      <QueryTable
        rowkey={(record) => record?.customerOrderId}
        reqExtraParams={{
          orderStatus: 'finished'
        }}
        ref={tableRef}
        columns={columns}
        pagingInServer
        requestUrl="/crm/business/order/page"
      />
      {/* <BusinessActionDrawer
        businessType="loan"
        setEditItem={setEditItem}
        editItem={editItem}
        isShow={actionDrawerStatus}
        onFinish={onFinish}
        onCancel={() => setActionDrawer(false)}
      /> */}
    </div>
  );
}

Loan.route = {
  [MENU_PATH]: "/business/loan",
};
